<template>
  <footer class="footer">
    <span class="todo-count" v-show="outList"
      ><strong>{{ outList }}</strong
      >剩余</span
    >
    <ul class="filters">
      <li>
        <a
          :class="{ selected: type === 'all' }"
          @click="changecolor('all')"
          href="#/"
          >全部</a
        >
      </li>
      <li>
        <a
          href="#/active"
          :class="{ selected: type === 'active' }"
          @click="changecolor('active')"
          >进行中</a
        >
      </li>
      <li>
        <a
          href="#/completed"
          :class="{ selected: type === 'completed' }"
          @click="changecolor('completed')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="clearIsDone" v-show="showClrea">
      清除已完成
    </button>
  </footer>
</template>

<script>
export default {
  name: 'Footer',
  props: {
    outList: {
      type: Number,
      required: true
    },
    showClrea: {
      type: Boolean,
      required: true
    },
    type: {
      type: String,
      required: true
    }
  },
  methods: {
    clearIsDone () {
      this.$emit('clearIsDone')
    },
    changecolor (type) {
      this.$emit('changecolor', type)
    }
  }
}
</script>

<style scoped lang="less"></style>
